import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/mining_stone_list_entity.dart';

MiningStoneListEntity $MiningStoneListEntityFromJson(
    Map<String, dynamic> json) {
  final MiningStoneListEntity miningStoneListEntity = MiningStoneListEntity();
  final List<MiningStoneListList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<MiningStoneListList>(e) as MiningStoneListList)
      .toList();
  if (list != null) {
    miningStoneListEntity.list = list;
  }
  final int? page = jsonConvert.convert<int>(json['page']);
  if (page != null) {
    miningStoneListEntity.page = page;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    miningStoneListEntity.pageSize = pageSize;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    miningStoneListEntity.total = total;
  }
  return miningStoneListEntity;
}

Map<String, dynamic> $MiningStoneListEntityToJson(
    MiningStoneListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  data['page'] = entity.page;
  data['pageSize'] = entity.pageSize;
  data['total'] = entity.total;
  return data;
}

extension MiningStoneListEntityExt on MiningStoneListEntity {
  MiningStoneListEntity copyWith({
    List<MiningStoneListList>? list,
    int? page,
    int? pageSize,
    int? total,
  }) {
    return MiningStoneListEntity()
      ..list = list ?? this.list
      ..page = page ?? this.page
      ..pageSize = pageSize ?? this.pageSize
      ..total = total ?? this.total;
  }
}

MiningStoneListList $MiningStoneListListFromJson(Map<String, dynamic> json) {
  final MiningStoneListList miningStoneListList = MiningStoneListList();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    miningStoneListList.id = id;
  }
  final String? userId = jsonConvert.convert<String>(json['userId']);
  if (userId != null) {
    miningStoneListList.userId = userId;
  }
  final int? outIn = jsonConvert.convert<int>(json['outIn']);
  if (outIn != null) {
    miningStoneListList.outIn = outIn;
  }
  final int? recordType = jsonConvert.convert<int>(json['recordType']);
  if (recordType != null) {
    miningStoneListList.recordType = recordType;
  }
  final int? stoneNum = jsonConvert.convert<int>(json['stoneNum']);
  if (stoneNum != null) {
    miningStoneListList.stoneNum = stoneNum;
  }
  final String? inId = jsonConvert.convert<String>(json['inId']);
  if (inId != null) {
    miningStoneListList.inId = inId;
  }
  final String? drnNum = jsonConvert.convert<String>(json['drnNum']);
  if (drnNum != null) {
    miningStoneListList.drnNum = drnNum;
  }
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    miningStoneListList.createdAt = createdAt;
  }
  return miningStoneListList;
}

Map<String, dynamic> $MiningStoneListListToJson(MiningStoneListList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['userId'] = entity.userId;
  data['outIn'] = entity.outIn;
  data['recordType'] = entity.recordType;
  data['stoneNum'] = entity.stoneNum;
  data['inId'] = entity.inId;
  data['drnNum'] = entity.drnNum;
  data['createdAt'] = entity.createdAt;
  return data;
}

extension MiningStoneListListExt on MiningStoneListList {
  MiningStoneListList copyWith({
    String? id,
    String? userId,
    int? outIn,
    int? recordType,
    int? stoneNum,
    String? inId,
    String? drnNum,
    int? createdAt,
  }) {
    return MiningStoneListList()
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..outIn = outIn ?? this.outIn
      ..recordType = recordType ?? this.recordType
      ..stoneNum = stoneNum ?? this.stoneNum
      ..inId = inId ?? this.inId
      ..drnNum = drnNum ?? this.drnNum
      ..createdAt = createdAt ?? this.createdAt;
  }
}